package com.aspose.cells.a.d;

import com.aspose.cells.Color;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Stack;

public class zea {
   private zdh a;
   private zdz b;
   private Stack c = new Stack();

   private zea() {
   }

   public zea(zdh var1) {
      this.a = var1;
   }

   public void a() {
      this.b = new zdz();
   }

   public void a(zew var1) throws Exception {
      var1.c("q");
      this.c.push(this.b.a());
   }

   public void b(zew var1) throws Exception {
      var1.c("Q");
      this.b = (zdz)com.aspose.cells.b.a.zl.a(this.c.pop(), zdz.class);
   }

   public void a(com.aspose.cells.b.a.b.a.zi var1, zew var2) throws Exception {
      var2.a(var1, "cm");
      this.b.b().b(var1);
   }

   public void a(zn var1, zew var2) throws Exception {
      StringBuilder var3 = new StringBuilder(64);
      Iterator var4 = var1.g().iterator();

      label61:
      while(var4.hasNext()) {
         zo var5 = (zo)var4.next();
         var3.setLength(0);
         zfc.a(var5.a(), var3);
         var3.append(" m");
         var2.c(com.aspose.cells.b.a.zr.a(var3));
         Iterator var6 = var5.g().iterator();

         while(true) {
            while(true) {
               if (!var6.hasNext()) {
                  continue label61;
               }

               zl var7 = (zl)var6.next();
               if (var7 instanceof zq) {
                  zq var16 = (zq)var7;
                  ArrayList var18 = var16.a();

                  for(int var20 = 0; var20 < var18.size(); ++var20) {
                     var3.setLength(0);
                     zfc.a((com.aspose.cells.b.a.b.zo)var18.get(var20), var3);
                     var3.append(" l");
                     var2.c(com.aspose.cells.b.a.zr.a(var3));
                  }
               } else if (var7 instanceof za) {
                  za var15 = (za)var7;
                  zt[] var17 = var15.c();
                  com.aspose.cells.b.a.b.zo[] var19 = new com.aspose.cells.b.a.b.zo[3];
                  zt[] var21 = var17;
                  int var12 = var17.length;

                  for(int var13 = 0; var13 < var12; ++var13) {
                     zt var14 = var21[var13];
                     var19[0] = var14.b();
                     var19[1] = var14.c();
                     var19[2] = var14.d();
                     var3.setLength(0);
                     zfc.a(var19, var3);
                     var3.append(" c");
                     var2.c(com.aspose.cells.b.a.zr.a(var3));
                  }
               } else if (var7 instanceof zp) {
                  zp var8 = (zp)var7;
                  com.aspose.cells.b.a.b.zo[] var9 = new com.aspose.cells.b.a.b.zo[3];

                  zt var11;
                  for(Iterator var10 = var8.a().iterator(); var10.hasNext(); var9[2] = var11.d()) {
                     var11 = (zt)var10.next();
                     var9[0] = var11.b();
                     var9[1] = var11.c();
                  }

                  var3.setLength(0);
                  zfc.a(var9, var3);
                  var3.append(" c");
                  var2.c(com.aspose.cells.b.a.zr.a(var3));
               }
            }
         }
      }

      if (var1.g().size() > 0) {
         var2.c("h W n");
      }

   }

   public void a(zdg var1, boolean var2, zew var3) throws Exception {
      if (var2) {
         if (var1 == this.b.c()) {
            return;
         }

         this.b.a(var1);
      } else {
         if (var1 == this.b.d()) {
            return;
         }

         this.b.b(var1);
      }

      StringBuilder var4 = new StringBuilder(32);
      var4.append('/');
      var4.append(var1.e());
      var4.append(var2 ? " CS" : " cs");
      var3.c(com.aspose.cells.b.a.zr.a(var4));
   }

   public void a(Color var1, boolean var2, zew var3) throws Exception {
      if (var2) {
         if (this.b.c() == zdg.b() && var1.toArgb() == this.b.e().toArgb()) {
            return;
         }

         this.b.a(zdg.b());
         this.b.a(var1);
      } else {
         if (this.b.d() == zdg.b() && var1.toArgb() == this.b.f().toArgb()) {
            return;
         }

         this.b.b(zdg.b());
         this.b.b(var1);
      }

      if ((var1.getA() & 255) < 255) {
         zdl var4 = this.a.c().a();
         if (this.a.h() != null) {
            var4.b(this.a.h().m());
         }

         float var5 = (float)(var1.getA() & 255) / 255.0F;
         if (var2) {
            var4.a(var5);
         } else {
            var4.b(var5);
         }

         this.a(var4, var3);
      }

      StringBuilder var6 = new StringBuilder(64);
      zfc.a(var1, var6);
      var6.append(var2 ? " RG" : " rg");
      var3.c(com.aspose.cells.b.a.zr.a(var6));
   }

   public void a(float var1, zew var2) throws Exception {
      if (var1 != this.b.g()) {
         this.b.a(var1);
         StringBuilder var3 = new StringBuilder(16);
         zfc.a(var1, var3);
         var3.append(" TL");
         var2.c(com.aspose.cells.b.a.zr.a(var3));
      }
   }

   public void a(zdw var1, float var2, zew var3) throws Exception {
      if (var1 != this.b.h() || var2 != this.b.i()) {
         this.b.a(var1);
         this.b.b(var2);
         StringBuilder var4 = new StringBuilder(64);
         var4.append('/');
         var4.append(var1.p());
         var4.append(' ');
         zfc.a(var2, var4);
         var4.append(" Tf");
         var3.c(com.aspose.cells.b.a.zr.a(var4));
      }
   }

   public void a(int var1, zew var2) throws Exception {
      if (var1 != this.b.j()) {
         this.b.a(var1);
         var2.c(var1 + " Tr");
      }
   }

   public void b(float var1, zew var2) throws Exception {
      StringBuilder var3 = new StringBuilder(16);
      zfc.a(var1, var3);
      var3.append(" Tc");
      var2.c(com.aspose.cells.b.a.zr.a(var3));
   }

   public void c(float var1, zew var2) throws Exception {
      if (var1 != this.b.k()) {
         this.b.c(var1);
         StringBuilder var3 = new StringBuilder(16);
         zfc.a(var1, var3);
         var3.append(" w");
         var2.c(com.aspose.cells.b.a.zr.a(var3));
      }
   }

   public void b(int var1, zew var2) throws Exception {
      if (var1 != this.b.l()) {
         this.b.b(var1);
         var2.c(var1 + " J");
      }
   }

   public void c(int var1, zew var2) throws Exception {
      if (var1 != this.b.m()) {
         this.b.c(var1);
         var2.c(var1 + " j");
      }
   }

   public void d(float var1, zew var2) throws Exception {
      if (var1 != this.b.n()) {
         this.b.d(var1);
         StringBuilder var3 = new StringBuilder(16);
         zfc.a(var1, var3);
         var3.append(" M");
         var2.c(com.aspose.cells.b.a.zr.a(var3));
      }
   }

   public void a(float[] var1, float var2, zew var3) throws Exception {
      StringBuilder var4 = new StringBuilder(64);
      zfc.a(var1, var4);
      var4.append(" ");
      zfc.a(var2, var4);
      var4.append(" d");
      var3.c(com.aspose.cells.b.a.zr.a(var4));
   }

   private void a(zdl var1, zew var2) throws Exception {
      if (!var1.a(this.b.o())) {
         this.b.a(var1);
         var2.c("/" + var1.p() + " gs");
      }
   }

   public com.aspose.cells.b.a.b.zq a(com.aspose.cells.b.a.b.zq var1) {
      com.aspose.cells.b.a.b.zo[] var2 = new com.aspose.cells.b.a.b.zo[]{new com.aspose.cells.b.a.b.zo(var1.j(), var1.k()), new com.aspose.cells.b.a.b.zo(var1.l(), var1.m())};
      this.b.b().a(var2);
      com.aspose.cells.b.a.b.zq var3 = new com.aspose.cells.b.a.b.zq();
      var3.a(Math.min(var2[0].d(), var2[1].d()));
      var3.b(Math.min(var2[0].e(), var2[1].e()));
      var3.c(Math.abs(var2[0].d() - var2[1].d()));
      var3.d(Math.abs(var2[0].e() - var2[1].e()));
      return var3;
   }

   public zdz b() {
      return this.b;
   }
}
